home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / PCI.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  7.9 KB  |  314 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        PCI.a
  3. ;
  4. ;    Contains:    PCI Bus Interfaces.
  5. ;
  6. ;    Version:    Technology:    PowerSurge 1.0.2
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1993-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__PCI__') = 'UNDEFINED' THEN
  18. __PCI__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.     IF &TYPE('__NAMEREGISTRY__') = 'UNDEFINED' THEN
  24.     include 'NameRegistry.a'
  25.     ENDIF
  26.  
  27. ;  Types and structures for accessing the PCI Assigned-Address property.
  28.  
  29.  
  30. kPCIRelocatableSpace            EQU        $80
  31. kPCIPrefetchableSpace            EQU        $40
  32. kPCIAliasedSpace                EQU        $20
  33. kPCIAddressTypeCodeMask            EQU        $03
  34. kPCIConfigSpace                    EQU        0
  35. kPCIIOSpace                        EQU        1
  36. kPCI32BitMemorySpace            EQU        2
  37. kPCI64BitMemorySpace            EQU        3
  38. ; typedef UInt8                         PCIAddressSpaceFlags
  39.  
  40.  
  41. kPCIDeviceNumberMask            EQU        $1F
  42. kPCIFunctionNumberMask            EQU        $07
  43. ; typedef UInt8                         PCIDeviceFunction
  44.  
  45. ; typedef UInt8                         PCIBusNumber
  46.  
  47. ; typedef UInt8                         PCIRegisterNumber
  48.  
  49. PCIAssignedAddress        RECORD 0
  50. addressSpaceFlags         ds.b    1                ; offset: $0 (0)
  51. busNumber                 ds.b    1                ; offset: $1 (1)
  52. deviceFunctionNumber     ds.b    1                ; offset: $2 (2)
  53. registerNumber             ds.b    1                ; offset: $3 (3)
  54. address                     ds        UnsignedWide    ; offset: $4 (4)
  55. size                     ds        UnsignedWide    ; offset: $C (12)
  56. sizeof                     EQU *                    ; size:   $14 (20)
  57.                         ENDR
  58. ; typedef struct PCIAssignedAddress *    PCIAssignedAddressPtr
  59.  
  60.  
  61.     IF TARGET_CPU_68K THEN
  62.         Macro
  63.         _EndianSwap32Bit &Dn
  64.             IF &Dn = '' THEN
  65.                 ROL.W    #8,D0
  66.                 SWAP    D0
  67.                 ROL.W    #8,D0
  68.             ELSE
  69.                 ROL.W    #8,&Dn
  70.                 SWAP    &Dn
  71.                 ROL.W    #8,&Dn
  72.             ENDIF
  73.         Endm
  74.     ELSE
  75.         IMPORT_CFM_FUNCTION    EndianSwap32Bit
  76.     ENDIF
  77.  
  78.     IF TARGET_CPU_68K THEN
  79.         Macro
  80.         _EndianSwap16Bit &Dn
  81.             IF &Dn = '' THEN
  82.                 ROL.W    #8,D0
  83.             ELSE
  84.                 ROL.W    #8,&Dn
  85.             ENDIF
  86.         Endm
  87.     ELSE
  88.         IMPORT_CFM_FUNCTION    EndianSwap16Bit
  89.     ENDIF
  90.  
  91. ;
  92. ; pascal OSErr ExpMgrConfigReadByte(RegEntryIDPtr node, LogicalAddress configAddr, UInt8 *valuePtr)
  93. ;
  94.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  95.         Macro
  96.         _ExpMgrConfigReadByte
  97.             move.w              #$0620,D0
  98.             dc.w                $AAF3
  99.         EndM
  100.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  101.         IMPORT_CFM_FUNCTION ExpMgrConfigReadByte
  102.     ENDIF
  103.  
  104. ;
  105. ; pascal OSErr ExpMgrConfigReadWord(RegEntryIDPtr node, LogicalAddress configAddr, UInt16 *valuePtr)
  106. ;
  107.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  108.         Macro
  109.         _ExpMgrConfigReadWord
  110.             move.w              #$0621,D0
  111.             dc.w                $AAF3
  112.         EndM
  113.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  114.         IMPORT_CFM_FUNCTION ExpMgrConfigReadWord
  115.     ENDIF
  116.  
  117. ;
  118. ; pascal OSErr ExpMgrConfigReadLong(RegEntryIDPtr node, LogicalAddress configAddr, UInt32 *valuePtr)
  119. ;
  120.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  121.         Macro
  122.         _ExpMgrConfigReadLong
  123.             move.w              #$0622,D0
  124.             dc.w                $AAF3
  125.         EndM
  126.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  127.         IMPORT_CFM_FUNCTION ExpMgrConfigReadLong
  128.     ENDIF
  129.  
  130. ;
  131. ; pascal OSErr ExpMgrConfigWriteByte(RegEntryIDPtr node, LogicalAddress configAddr, UInt8 value)
  132. ;
  133.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  134.         Macro
  135.         _ExpMgrConfigWriteByte
  136.             move.w              #$0523,D0
  137.             dc.w                $AAF3
  138.         EndM
  139.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  140.         IMPORT_CFM_FUNCTION ExpMgrConfigWriteByte
  141.     ENDIF
  142.  
  143. ;
  144. ; pascal OSErr ExpMgrConfigWriteWord(RegEntryIDPtr node, LogicalAddress configAddr, UInt16 value)
  145. ;
  146.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  147.         Macro
  148.         _ExpMgrConfigWriteWord
  149.             move.w              #$0524,D0
  150.             dc.w                $AAF3
  151.         EndM
  152.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  153.         IMPORT_CFM_FUNCTION ExpMgrConfigWriteWord
  154.     ENDIF
  155.  
  156. ;
  157. ; pascal OSErr ExpMgrConfigWriteLong(RegEntryIDPtr node, LogicalAddress configAddr, UInt32 value)
  158. ;
  159.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  160.         Macro
  161.         _ExpMgrConfigWriteLong
  162.             move.w              #$0625,D0
  163.             dc.w                $AAF3
  164.         EndM
  165.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  166.         IMPORT_CFM_FUNCTION ExpMgrConfigWriteLong
  167.     ENDIF
  168.  
  169. ;
  170. ; pascal OSErr ExpMgrIOReadByte(RegEntryIDPtr node, LogicalAddress ioAddr, UInt8 *valuePtr)
  171. ;
  172.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  173.         Macro
  174.         _ExpMgrIOReadByte
  175.             move.w              #$0626,D0
  176.             dc.w                $AAF3
  177.         EndM
  178.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  179.         IMPORT_CFM_FUNCTION ExpMgrIOReadByte
  180.     ENDIF
  181.  
  182. ;
  183. ; pascal OSErr ExpMgrIOReadWord(RegEntryIDPtr node, LogicalAddress ioAddr, UInt16 *valuePtr)
  184. ;
  185.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  186.         Macro
  187.         _ExpMgrIOReadWord
  188.             move.w              #$0627,D0
  189.             dc.w                $AAF3
  190.         EndM
  191.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  192.         IMPORT_CFM_FUNCTION ExpMgrIOReadWord
  193.     ENDIF
  194.  
  195. ;
  196. ; pascal OSErr ExpMgrIOReadLong(RegEntryIDPtr node, LogicalAddress ioAddr, UInt32 *valuePtr)
  197. ;
  198.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  199.         Macro
  200.         _ExpMgrIOReadLong
  201.             move.w              #$0628,D0
  202.             dc.w                $AAF3
  203.         EndM
  204.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  205.         IMPORT_CFM_FUNCTION ExpMgrIOReadLong
  206.     ENDIF
  207.  
  208. ;
  209. ; pascal OSErr ExpMgrIOWriteByte(RegEntryIDPtr node, LogicalAddress ioAddr, UInt8 value)
  210. ;
  211.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  212.         Macro
  213.         _ExpMgrIOWriteByte
  214.             move.w              #$0529,D0
  215.             dc.w                $AAF3
  216.         EndM
  217.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  218.         IMPORT_CFM_FUNCTION ExpMgrIOWriteByte
  219.     ENDIF
  220.  
  221. ;
  222. ; pascal OSErr ExpMgrIOWriteWord(RegEntryIDPtr node, LogicalAddress ioAddr, UInt16 value)
  223. ;
  224.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  225.         Macro
  226.         _ExpMgrIOWriteWord
  227.             move.w              #$052A,D0
  228.             dc.w                $AAF3
  229.         EndM
  230.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  231.         IMPORT_CFM_FUNCTION ExpMgrIOWriteWord
  232.     ENDIF
  233.  
  234. ;
  235. ; pascal OSErr ExpMgrIOWriteLong(RegEntryIDPtr node, LogicalAddress ioAddr, UInt32 value)
  236. ;
  237.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  238.         Macro
  239.         _ExpMgrIOWriteLong
  240.             move.w              #$062B,D0
  241.             dc.w                $AAF3
  242.         EndM
  243.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  244.         IMPORT_CFM_FUNCTION ExpMgrIOWriteLong
  245.     ENDIF
  246.  
  247. ;
  248. ; pascal OSErr ExpMgrInterruptAcknowledgeReadByte(RegEntryIDPtr entry, UInt8 *valuePtr)
  249. ;
  250.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  251.         Macro
  252.         _ExpMgrInterruptAcknowledgeReadByte
  253.             move.w              #$0411,D0
  254.             dc.w                $AAF3
  255.         EndM
  256.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  257.         IMPORT_CFM_FUNCTION ExpMgrInterruptAcknowledgeReadByte
  258.     ENDIF
  259.  
  260. ;
  261. ; pascal OSErr ExpMgrInterruptAcknowledgeReadWord(RegEntryIDPtr entry, UInt16 *valuePtr)
  262. ;
  263.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  264.         Macro
  265.         _ExpMgrInterruptAcknowledgeReadWord
  266.             move.w              #$0412,D0
  267.             dc.w                $AAF3
  268.         EndM
  269.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  270.         IMPORT_CFM_FUNCTION ExpMgrInterruptAcknowledgeReadWord
  271.     ENDIF
  272.  
  273. ;
  274. ; pascal OSErr ExpMgrInterruptAcknowledgeReadLong(RegEntryIDPtr entry, UInt32 *valuePtr)
  275. ;
  276.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  277.         Macro
  278.         _ExpMgrInterruptAcknowledgeReadLong
  279.             move.w              #$0413,D0
  280.             dc.w                $AAF3
  281.         EndM
  282.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  283.         IMPORT_CFM_FUNCTION ExpMgrInterruptAcknowledgeReadLong
  284.     ENDIF
  285.  
  286. ;
  287. ; pascal OSErr ExpMgrSpecialCycleWriteLong(RegEntryIDPtr entry, UInt32 value)
  288. ;
  289.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  290.         Macro
  291.         _ExpMgrSpecialCycleWriteLong
  292.             move.w              #$0419,D0
  293.             dc.w                $AAF3
  294.         EndM
  295.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  296.         IMPORT_CFM_FUNCTION ExpMgrSpecialCycleWriteLong
  297.     ENDIF
  298.  
  299. ;
  300. ; pascal OSErr ExpMgrSpecialCycleBroadcastLong(UInt32 value)
  301. ;
  302.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  303.         Macro
  304.         _ExpMgrSpecialCycleBroadcastLong
  305.             move.w              #$021A,D0
  306.             dc.w                $AAF3
  307.         EndM
  308.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  309.         IMPORT_CFM_FUNCTION ExpMgrSpecialCycleBroadcastLong
  310.     ENDIF
  311.  
  312.     ENDIF ; __PCI__ 
  313.  
  314.